package project.user.internal;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import project.user.User;
import project.user.UserService;

public class UserServiceImpl extends HibernateDaoSupport implements UserService {


    @Override
    public void update(User user) {
        this.getHibernateTemplate().update(user);
    }

    public void save(User user) {
        this.getHibernateTemplate().save(user);
    }

    @Override
    public User find(String openid) {
        StringBuffer queryString = new StringBuffer(" FROM User where openId=?");
        List<User> list = this.getHibernateTemplate().find(queryString.toString(), openid);
        if (list.size() > 0) {
            return list.get(0);
        }
        return null;
    }



}
